#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>

using std::cout;
using std::endl;
using std::for_each;
using std::vector;
using std::ostream_iterator;
using std::copy;

void func(int &value){
    /* ++value; */
    cout << value << " ";
}

void test0(){
    vector<int> vec = {1,9,3,4,2,8};
    /* for_each(vec.begin(),vec.end(),func); */
    for_each(vec.begin(),vec.end(),[](int value){
             cout << ++value << " ";
             });
    cout << endl;

    copy(vec.begin(),vec.end(),ostream_iterator<int>(cout," "));
   cout << endl;
}

int main(int argc, char * argv[])
{
    test0();
    return 0;
}


